import java.util.*;
import java.util.Scanner;

public class ���������� {
	
	static int N = 200010;
	static String[] str = new String[N];
	
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		s.nextLine();
		for(int i=0;i<n;i++) 
			str[i] = s.nextLine();
			
		Arrays.sort(str, new Comparator<String>() {
			public int compare(String s1,String s2) {
				return (s1+s2).compareTo(s2+s1);
			}
		});
		
		for(int i=0;i<n;i++)
			System.out.print(str[i]);
		
	}

}
